
<CFMODULE TEMPLATE="#client.common_path#util/cfm_saveaudithdr.cfm"
	TABLENAME = "#sAuditTablename#"
	ACTION = "#sAuditAction#"
	COMPONENTCODE = "forms"
	RECID = "#GetForm.FORMCODE#"
	TABLELEVEL="#sAuditTableLevel#"
>

<CFIF IsDefined("aAuditExtraField")>
	<CFSET nTo=ArrayLen(aAuditExtraField)>
	<CFLOOP FROM="1" TO="#nTo#" INDEX="x">
		<CFMODULE TEMPLATE="#client.common_path#util/cfm_saveauditdtl.cfm"
			columnname = "#aAuditExtraField[x][1]#"
			columntype = "#myColType#"
			auditTranCode = "#auditTranCode#"
			auditOldValue = ""
			auditNewValue = "#aAuditExtraField[x][2]#"
			TABLELEVEL="#sAuditTableLevel#"
		>
	</CFLOOP>
</CFIF>

<!---<CFLOOP QUERY="qryAuditFields">--->
<CFLOOP QUERY = "getFields">
	<CFIF ISDEFINED("ISMULTIRECORD") AND ISMULTIRECORD>
		<CFIF sAuditAction IS "A">
			<CFSET sAuditOldValue="">
			<CFSET sAuditNewValue=Evaluate("Form.EDTMASTER" & COLUMNNAME & "1")>
		<CFELSEIF sAuditAction IS "E">
			<CFSET sAuditOldValue=Evaluate("qryAuditGetOldValue." & COLUMNNAME)>
			<CFSET sAuditNewValue=Evaluate("Form.EDTMASTER" & COLUMNNAME & "1")>
		<CFELSE>
			<CFSET sAuditOldValue=Evaluate("qryAuditGetOldValue." & COLUMNNAME)>
			<CFSET sAuditNewValue="">
		</CFIF>
		<!--- Added by Soti 06/14/2004 to change case of string data based on config in dataarchitect --->
		<CFIF CHARCASE EQ "ecUpperCase">
			<CFSET sAuditNewValue = ucase(sAuditNewValue)>
		<CFELSEIF CHARCASE EQ "ecLowerCase">
			<CFSET sAuditNewValue = lcase(sAuditNewValue)>
		</CFIF>

		<CFMODULE TEMPLATE="#client.common_path#util/cfm_saveauditdtl.cfm"
			columnname = "#COLUMNNAME#"
			columntype = "ftString"
			auditTranCode = "#auditTranCode#"
			auditOldValue = "#sAuditOldValue#"
			auditNewValue = "#sAuditNewValue#"
			TABLELEVEL="#sAuditTableLevel#"
		>
	<CFELSEIF IsDefined("Form.edt" & qryAuditFields.COLUMNNAME)>
		<CFIF sAuditAction IS "A">
			<CFSET sAuditOldValue="">
			<CFSET sAuditNewValue=Evaluate("Form.edt" & qryAuditFields.COLUMNNAME)>
		<CFELSEIF sAuditAction IS "E">
			<CFSET sAuditOldValue=Evaluate("qryAuditGetOldValue." & qryAuditFields.COLUMNNAME)>
			<CFSET sAuditNewValue=Evaluate("Form.edt" & qryAuditFields.COLUMNNAME)>
		<CFELSE>
			<CFSET sAuditOldValue=Evaluate("qryAuditGetOldValue." & qryAuditFields.COLUMNNAME)>
			<CFSET sAuditNewValue="">
		</CFIF>
		<!--- Added by Soti 06/14/2004 to change case of string data based on config in dataarchitect --->
		<CFIF CHARCASE EQ "ecUpperCase">
			<CFSET sAuditNewValue = ucase(sAuditNewValue)>
		<CFELSEIF CHARCASE EQ "ecLowerCase">
			<CFSET sAuditNewValue = lcase(sAuditNewValue)>
		</CFIF>

		<CFMODULE TEMPLATE="#client.common_path#util/cfm_saveauditdtl.cfm"
			columnname = "#qryAuditFields.COLUMNNAME#"
			columntype = "#myColType#"
			auditTranCode = "#auditTranCode#"
			auditOldValue = "#sAuditOldValue#"
			auditNewValue = "#sAuditNewValue#"
			TABLELEVEL="#sAuditTableLevel#"
		>
	</CFIF>
</CFLOOP>